<!-- File: /app/View/Pages/index.ctp -->

<h1>Blog pages</h1>

<?php echo $this->Html->link('Add Page', array('action' => 'add'), array('class' => 'button')); ?>
<table>
    <tr>
        <th>Id</th>
        <th>Title</th>
        <!--
        <th>Catégorie</th>
        <th>Sous-catégorie</th>
        -->
        <th>Image</th>
        <th>Action</th>
        <th>Created</th>
    </tr>

    <!-- Here is where we loop through our $pages array, printing out page info -->

    <?php foreach ($pages as $page): ?>
        <tr>
            <td><?php echo $page['Page']['id']; ?></td>
            <td>
                <?php echo $this->Html->link(
                    $page['Page']['title'],
                    array(
                        'controller' => 'pages',
                        'action' => 'view',
                        $page['Page']['title'],
                        $page['Page']['id']
                    )
                ); ?>
            </td>
            <!--
            <td><?php echo $page['Category']['name']; ?></td>
            <td><?php echo $page['SubCategory']['name']; ?></td>
            -->
            <td><img src="<?php echo $page['Page']['image']; ?>"/></td>
            <td>
                <?php
                echo $this->Html->link('Edit', array('action' => 'edit', $page['Page']['id']), array('class' => 'button'));
                echo $this->Form->postLink('Delete', array('action' => 'delete', $page['Page']['id']), array('confirm' => 'Are you sure?', 'class' => 'button'));
                ?>
            </td>
            <td><?php echo $page['Page']['created']; ?></td>
        </tr>
    <?php endforeach; ?>
    <?php unset($page); ?>
</table>